<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>编辑用户管理</h2>
    </div>
   	 	<form action="{:U('FuturesUser/edit')}" method="post" class="form-horizontal">
        <input type="hidden" name="id" value="{$data.id}">
        <div class="form-item">
            <label class="item-label">用户昵称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" readonly name="nickname" value="{$data.nickname}" >
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">用户余额<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" readonly name="money" value="{$data.money}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">经纪人<span class="check-tips"></span></label>
            <select name="is_agent" >
                    <option value="0" <if condition="$data.is_agent eq 0">selected</if>  style="width:200px">否</option>
                    <option value="1" <if condition="$data.is_agent eq 1">selected</if>  style="width:200px">是</option>
            </select>
        </div>
        <div class="form-item">
            <label class="item-label">输入交易密码<span class="check-tips"></span></label>
            <div class="controls">
                <input type="password" class="text input-large" name="futures_pwd" value="" autocomplete="off">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">重复交易密码<span class="check-tips"></span></label>
            <div class="controls">
                <input type="password" class="text input-large" name="refutures_pwd" value="" autocomplete="off">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">电话号码<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="mobile" value="{$data.mobile}" maxlength="11">
            </div>
        </div>
        <div class="form-item">

            <label class="item-label">所属上级<span class="check-tips"></span></label>
            <select name="route" id = "route_data">
            			<option value="" <if condition="empty($route)">selected</if>  style="width:200px">无</option>
            	<foreach name = "list" item = "v">
            			<option value="{$v .id}" <if condition="$route eq $v['id']">selected</if>  style="width:200px">{$v.nickname}</option>
                </foreach>
            </select>
            <input type="text" class="text" name = "nickname" placeholder="搜索上级用户" id = "nickname">
            <a class="btn" href = "javascript:ajax(0)">搜索</a>
        </div>
        <div class="form-item">
            <button class="btn submit-btn" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    	</form>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
    <script type="text/javascript">
        $('#begin_time,#end_time').datetimepicker({
            format: 'yyyy-mm-dd h:i:s',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('FuturesUser/index')}"]').closest('li').addClass('current');
    </script>
    <script type="text/javascript">
		function ajax(){
			var url = "{:U("FuturesUser/edit")}";
			$.post(url,{nickname : $('#nickname').val()},routeData,"json");
			function routeData(data){
				var length = data.length;
				var option = "";
				for(var i=0;i<length;i++){
					option += "<option value="+data[i].id+" style='width:200px'>"+data[i].nickname+"</option>";
				}
				$('#route_data').html(option);

			}
		}
	</script>
</block>
